from django.db import models
from rest_framework import serializers


class Message(models.Model):
    subject = models.CharField(max_length=200)
    body = models.TextField()


class MessageSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Message
        fields = ('url', 'subject', 'body', 'pk')


class DlModel(models.Model):
    name = models.CharField(max_length=200)
    owner = models.CharField(max_length=200)
    model_type = models.CharField(max_length=200)
    model_file = models.CharField(max_length=200)
    model_params = models.CharField(max_length=20000)


class FishInfo(models.Model):
    label = models.CharField(max_length=200,default='')
    name = models.CharField(max_length=200)
    introduce = models.CharField(max_length=2000)
    outline = models.CharField(max_length=2000)
    distribute = models.CharField(max_length=2000)
    habit = models.CharField(max_length=2000)
    food = models.CharField(max_length=2000)
    water = models.CharField(max_length=2000)
    disease = models.CharField(max_length=2000)
    life = models.CharField(max_length=2000)


class DlModelSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = DlModel
        fields = ('label','name', 'owner', 'model_type', 'model_file', 'model_params')


class FishInfoSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = FishInfo
        fields = ('label','name', 'introduce', 'outline', 'distribute', 'habit', 'food',
                  'water', 'disease', 'life')
